package org.keshproject.dms.util;

import java.util.HashMap;
import java.util.Map;

import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFDataFormat;
import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.DataFormat;
import org.apache.poi.ss.usermodel.Font;
import org.apache.poi.ss.usermodel.IndexedColors;
import org.apache.poi.ss.usermodel.Workbook;
import org.keshproject.dms.pojo.BalanceSheet;

public class ExcelReportUtil {

	static public HSSFWorkbook getFinanceReport(BalanceSheet bs2008,
			BalanceSheet bs2009) {

		HSSFWorkbook wb = new HSSFWorkbook();
		Map<String, CellStyle> styles = createStyles(wb);
		HSSFSheet sheet = wb.createSheet("资产负债表");

		HSSFRow row = null;
		HSSFCell cell = null;

		sheet.setColumnWidth(0, 28 * 256);
		sheet.setColumnWidth(1, 16 * 256);
		sheet.setColumnWidth(2, 16 * 256);
		sheet.setColumnWidth(3, 28 * 256);
		sheet.setColumnWidth(4, 16 * 256);
		sheet.setColumnWidth(5, 16 * 256);

		row = sheet.createRow(0);
		row.setHeightInPoints((float) 14.5);
		cell = row.createCell(0, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("资产");
		cell.setCellStyle(styles.get("header0"));
		cell = row.createCell(1, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("12/31/2008");
		cell.setCellStyle(styles.get("header1"));
		cell = row.createCell(2, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("12/31/2009");
		cell.setCellStyle(styles.get("header1"));
		cell = row.createCell(3, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("负债和所有权益");
		cell.setCellStyle(styles.get("header0"));
		cell = row.createCell(4, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("12/31/2008");
		cell.setCellStyle(styles.get("header1"));
		cell = row.createCell(5, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("12/31/2009");
		cell.setCellStyle(styles.get("header1"));

		row = sheet.createRow(1);
		row.setHeightInPoints((float) 14.5);
		cell = row.createCell(0, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("货币资金");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(1, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getCash());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(2, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getCash());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(3, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("短期借款");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(4, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getShortTermLoans());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(5, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getShortTermLoans());
		cell.setCellStyle(styles.get("detail1"));

		row = sheet.createRow(2);
		row.setHeightInPoints((float) 14.5);
		cell = row.createCell(0, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("短期投资");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(1, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getShortTermInvestments());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(2, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getShortTermInvestments());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(3, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("应付票据");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(4, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getNotesPayable());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(5, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getNotesPayable());
		cell.setCellStyle(styles.get("detail1"));

		row = sheet.createRow(3);
		row.setHeightInPoints((float) 14.5);
		cell = row.createCell(0, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("应收票据");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(1, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getNotesReceivable());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(2, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getNotesReceivable());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(3, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("应付账款");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(4, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getAccountsPayable());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(5, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getAccountsPayable());
		cell.setCellStyle(styles.get("detail1"));

		row = sheet.createRow(4);
		row.setHeightInPoints((float) 14.5);
		cell = row.createCell(0, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("应收账款");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(1, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getAccountsReceivable());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(2, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getAccountsReceivable());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(3, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("预收账款");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(4, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getAdvancesFromCustomers());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(5, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getAdvancesFromCustomers());
		cell.setCellStyle(styles.get("detail1"));

		row = sheet.createRow(5);
		row.setHeightInPoints((float) 14.5);
		cell = row.createCell(0, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("其他应收款");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(1, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getOtherReceivables());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(2, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getOtherReceivables());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(3, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("应付职工薪酬");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(4, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getAccruedPayroll());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(5, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getAccruedPayroll());
		cell.setCellStyle(styles.get("detail1"));

		row = sheet.createRow(6);
		row.setHeightInPoints((float) 14.5);
		cell = row.createCell(0, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("预付账款");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(1, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getAccountsPrepaid());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(2, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getAccountsPrepaid());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(3, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("应付利息");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(4, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getInterestsPayable());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(5, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getInterestsPayable());
		cell.setCellStyle(styles.get("detail1"));

		row = sheet.createRow(7);
		row.setHeightInPoints((float) 14.5);
		cell = row.createCell(0, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("应收补贴款");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(1, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getAllowanceReceivable());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(2, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getAllowanceReceivable());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(3, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("应付股利");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(4, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getProfitsPayable());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(5, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getProfitsPayable());
		cell.setCellStyle(styles.get("detail1"));

		row = sheet.createRow(8);
		row.setHeightInPoints((float) 14.5);
		cell = row.createCell(0, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("应收出口退税");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(1, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getExportDrawbackReceivable());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(2, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getExportDrawbackReceivable());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(3, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("应交税金");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(4, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getTaxesPayable());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(5, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getTaxesPayable());
		cell.setCellStyle(styles.get("detail1"));

		row = sheet.createRow(9);
		row.setHeightInPoints((float) 14.5);
		cell = row.createCell(0, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("存    货");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(1, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getInventories());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(2, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getInventories());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(3, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("其他应交款");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(4, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getOtherPayableToGovernment());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(5, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getOtherPayableToGovernment());
		cell.setCellStyle(styles.get("detail1"));

		row = sheet.createRow(10);
		row.setHeightInPoints((float) 14.5);
		cell = row.createCell(0, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("其中：原材料");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(1, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getInventoriesRawMaterials());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(2, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getInventoriesRawMaterials());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(3, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("其他应付款");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(4, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getOtherCreditors());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(5, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getOtherCreditors());
		cell.setCellStyle(styles.get("detail1"));

		row = sheet.createRow(11);
		row.setHeightInPoints((float) 14.5);
		cell = row.createCell(0, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("      产成品");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(1, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getInventoriesFinishedGoods());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(2, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getInventoriesFinishedGoods());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(3, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("预提费用");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(4, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getProvisionForExpenses());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(5, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getProvisionForExpenses());
		cell.setCellStyle(styles.get("detail1"));

		row = sheet.createRow(12);
		row.setHeightInPoints((float) 14.5);
		cell = row.createCell(0, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("其他流动资产");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(1, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getOtherCurrentAssets());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(2, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getOtherCurrentAssets());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(3, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("一年内到期长期负债");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(4, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getLongTermLiabilitiesDueWithOneYear());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(5, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getLongTermLiabilitiesDueWithOneYear());
		cell.setCellStyle(styles.get("detail1"));

		row = sheet.createRow(13);
		row.setHeightInPoints((float) 14.5);
		cell = row.createCell(0, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("流动资产合计");
		cell.setCellStyle(styles.get("detail2"));
		cell = row.createCell(1, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getTotalCurrentAssets());
		cell.setCellStyle(styles.get("detail3"));
		cell = row.createCell(2, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getTotalCurrentAssets());
		cell.setCellStyle(styles.get("detail3"));
		cell = row.createCell(3, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("其他流动负债");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(4, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getOtherCurrentLiabilities());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(5, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getOtherCurrentLiabilities());
		cell.setCellStyle(styles.get("detail1"));

		row = sheet.createRow(14);
		row.setHeightInPoints((float) 14.5);
		cell = row.createCell(0, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("可供出售金融资产");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(1, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getAvailableForSaleFinancialAssets());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(2, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getAvailableForSaleFinancialAssets());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(3, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("流动负债合计");
		cell.setCellStyle(styles.get("detail2"));
		cell = row.createCell(4, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getTotalCurrentLiabilities());
		cell.setCellStyle(styles.get("detail3"));
		cell = row.createCell(5, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getTotalCurrentLiabilities());
		cell.setCellStyle(styles.get("detail3"));

		row = sheet.createRow(15);
		row.setHeightInPoints((float) 14.5);
		cell = row.createCell(0, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("持有至到期资产");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(1, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getAssetsHeldToMaturity());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(2, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getAssetsHeldToMaturity());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(3, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(4, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("");
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(5, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("");
		cell.setCellStyle(styles.get("detail1"));

		row = sheet.createRow(16);
		row.setHeightInPoints((float) 14.5);
		cell = row.createCell(0, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("长期股权投资");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(1, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getLongTermEquityInvestment());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(2, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getLongTermEquityInvestment());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(3, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("长期借款");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(4, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getLongTermLoansPayable());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(5, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getLongTermLoansPayable());
		cell.setCellStyle(styles.get("detail1"));

		row = sheet.createRow(17);
		row.setHeightInPoints((float) 14.5);
		cell = row.createCell(0, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("长期债券投资");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(1, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getLongTermSecuritiesInvestment());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(2, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getLongTermSecuritiesInvestment());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(3, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("长期应付款");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(4, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getLongTermAccountsPayable());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(5, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getLongTermAccountsPayable());
		cell.setCellStyle(styles.get("detail1"));

		row = sheet.createRow(18);
		row.setHeightInPoints((float) 14.5);
		cell = row.createCell(0, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("投资性房地产");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(1, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getInvestmentProperty());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(2, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getInvestmentProperty());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(3, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("  专项应付款");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(4, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getSpecialAccountsPayable());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(5, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getSpecialAccountsPayable());
		cell.setCellStyle(styles.get("detail1"));

		row = sheet.createRow(19);
		row.setHeightInPoints((float) 14.5);
		cell = row.createCell(0, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("固定资产原值");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(1, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getFixedAssetsCost());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(2, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getFixedAssetsCost());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(3, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("  递延收益");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(4, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getDeferredGainOn());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(5, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getDeferredGainOn());
		cell.setCellStyle(styles.get("detail1"));

		row = sheet.createRow(20);
		row.setHeightInPoints((float) 14.5);
		cell = row.createCell(0, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("减：累计折旧");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(1, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getAccumulatedDepreciation());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(2, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getAccumulatedDepreciation());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(3, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("长期负债合计");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(4, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getTotalLongTermLiabilities());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(5, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getTotalLongTermLiabilities());
		cell.setCellStyle(styles.get("detail1"));

		row = sheet.createRow(21);
		row.setHeightInPoints((float) 14.5);
		cell = row.createCell(0, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("固定资产净值");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(1, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getFixedAssetsNetValue());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(2, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getFixedAssetsNetValue());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(3, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("负债合计");
		cell.setCellStyle(styles.get("detail2"));
		cell = row.createCell(4, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getTotalLiabilities());
		cell.setCellStyle(styles.get("detail3"));
		cell = row.createCell(5, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getTotalLiabilities());
		cell.setCellStyle(styles.get("detail3"));

		row = sheet.createRow(22);
		row.setHeightInPoints((float) 14.5);
		cell = row.createCell(0, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("减：固定资产减值准备");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(1, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getImpairmentOfFixedAssets());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(2, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getImpairmentOfFixedAssets());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(3, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(4, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("");
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(5, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("");
		cell.setCellStyle(styles.get("detail1"));

		row = sheet.createRow(23);
		row.setHeightInPoints((float) 14.5);
		cell = row.createCell(0, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("固定资产净额");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(1, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getNetValueOfFixedAssets());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(2, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getNetValueOfFixedAssets());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(3, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("所有者权益");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(4, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getShareholderEquity());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(5, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getShareholderEquity());
		cell.setCellStyle(styles.get("detail1"));

		row = sheet.createRow(24);
		row.setHeightInPoints((float) 14.5);
		cell = row.createCell(0, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("工程物资");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(1, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getProjectMaterial());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(2, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getProjectMaterial());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(3, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("少数股东权益");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(4, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getMinorityInterests());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(5, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getMinorityInterests());
		cell.setCellStyle(styles.get("detail1"));

		row = sheet.createRow(25);
		row.setHeightInPoints((float) 14.5);
		cell = row.createCell(0, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("在建工程");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(1, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getConstructionInProcess());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(2, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getConstructionInProcess());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(3, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("实收资本");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(4, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getSubscribedCapital());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(5, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getSubscribedCapital());
		cell.setCellStyle(styles.get("detail1"));

		row = sheet.createRow(26);
		row.setHeightInPoints((float) 14.5);
		cell = row.createCell(0, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("固定资产清理");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(1, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getDisposalOfFixedAssets());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(2, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getDisposalOfFixedAssets());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(3, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("其中：中方投资");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(4, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getChineseInvestment());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(5, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getChineseInvestment());
		cell.setCellStyle(styles.get("detail1"));

		row = sheet.createRow(27);
		row.setHeightInPoints((float) 14.5);
		cell = row.createCell(0, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("待处理固定资产净损失");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(1, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getUnsettledGlOnFixedAssets());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(2, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getUnsettledGlOnFixedAssets());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(3, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("      外方投资");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(4, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getForeignInverstment());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(5, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getForeignInverstment());
		cell.setCellStyle(styles.get("detail1"));

		row = sheet.createRow(28);
		row.setHeightInPoints((float) 14.5);
		cell = row.createCell(0, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("固定资产合计");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(1, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getTotalTangibleAssets());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(2, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getTotalTangibleAssets());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(3, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("资本公积");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(4, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getCapitalSurplus());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(5, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getCapitalSurplus());
		cell.setCellStyle(styles.get("detail1"));

		row = sheet.createRow(29);
		row.setHeightInPoints((float) 14.5);
		cell = row.createCell(0, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("无形资产");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(1, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getIntangibleAssets());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(2, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getIntangibleAssets());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(3, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("盈余公积");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(4, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getSurplusReserve());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(5, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getSurplusReserve());
		cell.setCellStyle(styles.get("detail1"));

		row = sheet.createRow(30);
		row.setHeightInPoints((float) 14.5);
		cell = row.createCell(0, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("长期待摊费用");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(1, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getDeferredAssets());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(2, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getDeferredAssets());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(3, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("其中：法定公益金");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(4, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getStatutorySurplusReserve());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(5, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getStatutorySurplusReserve());
		cell.setCellStyle(styles.get("detail1"));

		row = sheet.createRow(31);
		row.setHeightInPoints((float) 14.5);
		cell = row.createCell(0, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("递延所得税资产");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(1, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getDeferredTaxAssets());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(2, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getDeferredTaxAssets());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(3, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("未分配利润");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(4, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getRetainedEarnings());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(5, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getRetainedEarnings());
		cell.setCellStyle(styles.get("detail1"));

		row = sheet.createRow(32);
		row.setHeightInPoints((float) 14.5);
		cell = row.createCell(0, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("其他长期资产");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(1, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getOtherLongTermAssets());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(2, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getOtherLongTermAssets());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(3, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("外币报表折算差额");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(4, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008
				.getConvertedDifferenceInForeighCurrencyStatements());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(5, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009
				.getConvertedDifferenceInForeighCurrencyStatements());
		cell.setCellStyle(styles.get("detail1"));

		row = sheet.createRow(33);
		row.setHeightInPoints((float) 14.5);
		cell = row.createCell(0, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("非流动资产合计");
		cell.setCellStyle(styles.get("detail2"));
		cell = row.createCell(1, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getTotalNonCurrentAssets());
		cell.setCellStyle(styles.get("detail3"));
		cell = row.createCell(2, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getTotalNonCurrentAssets());
		cell.setCellStyle(styles.get("detail3"));
		cell = row.createCell(3, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("所有者权益合计");
		cell.setCellStyle(styles.get("detail0"));
		cell = row.createCell(4, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getTotalShareholderEquity());
		cell.setCellStyle(styles.get("detail1"));
		cell = row.createCell(5, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getTotalShareholderEquity());
		cell.setCellStyle(styles.get("detail1"));

		row = sheet.createRow(34);
		row.setHeightInPoints((float) 14.5);
		cell = row.createCell(0, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("资产合计");
		cell.setCellStyle(styles.get("detail2"));
		cell = row.createCell(1, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getTotalAssets());
		cell.setCellStyle(styles.get("detail3"));
		cell = row.createCell(2, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getTotalAssets());
		cell.setCellStyle(styles.get("detail3"));
		cell = row.createCell(3, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue("负债及所有者权益合计");
		cell.setCellStyle(styles.get("detail2"));
		cell = row.createCell(4, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2008.getTotalLiabilitiesEquity());
		cell.setCellStyle(styles.get("detail3"));
		cell = row.createCell(5, HSSFCell.CELL_TYPE_STRING);
		cell.setCellValue(bs2009.getTotalLiabilitiesEquity());
		cell.setCellStyle(styles.get("detail3"));

		return wb;
	}

	/**
	 * create a library of cell styles
	 */
	private static Map<String, CellStyle> createStyles(Workbook wb) {
		Map<String, CellStyle> styles = new HashMap<String, CellStyle>();
		CellStyle style;
		DataFormat df = wb.createDataFormat();

		Font font1 = wb.createFont();
		font1.setFontHeight((short) (10.5 * 20));
		font1.setFontName("宋体");

		Font font2 = wb.createFont();
		font2.setFontHeight((short) (10.5 * 20));
		font2.setFontName("宋体");
		font2.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);

		style = wb.createCellStyle();
		style.setAlignment(CellStyle.ALIGN_GENERAL);
		style.setVerticalAlignment(CellStyle.VERTICAL_JUSTIFY);
		style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
		style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
		style.setBorderRight(CellStyle.BORDER_HAIR);
		style.setBorderBottom(CellStyle.BORDER_HAIR);
		style.setBorderLeft(CellStyle.BORDER_HAIR);
		style.setBorderTop(CellStyle.BORDER_HAIR);
		style.setFont(font1);
		style.setWrapText(true);
		styles.put("header0", style);

		style = wb.createCellStyle();
		style.setAlignment(CellStyle.ALIGN_RIGHT);
		style.setVerticalAlignment(CellStyle.VERTICAL_JUSTIFY);
		style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
		style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
		style.setBorderRight(CellStyle.BORDER_HAIR);
		style.setBorderBottom(CellStyle.BORDER_HAIR);
		style.setBorderLeft(CellStyle.BORDER_HAIR);
		style.setBorderTop(CellStyle.BORDER_HAIR);
		style.setFont(font1);
		style.setWrapText(true);
		styles.put("header1", style);

		style = wb.createCellStyle();
		style.setAlignment(CellStyle.ALIGN_LEFT);
		style.setVerticalAlignment(CellStyle.VERTICAL_JUSTIFY);
		style.setFillForegroundColor(IndexedColors.WHITE.getIndex());
		style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
		style.setBorderRight(CellStyle.BORDER_HAIR);
		style.setBorderBottom(CellStyle.BORDER_HAIR);
		style.setBorderLeft(CellStyle.BORDER_HAIR);
		style.setBorderTop(CellStyle.BORDER_HAIR);
		style.setFont(font1);
		style.setWrapText(true);
		styles.put("detail0", style);

		style = wb.createCellStyle();
		style.setAlignment(CellStyle.ALIGN_RIGHT);
		style.setVerticalAlignment(CellStyle.VERTICAL_JUSTIFY);
		style.setFillForegroundColor(IndexedColors.WHITE.getIndex());
		style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
		style.setBorderRight(CellStyle.BORDER_HAIR);
		style.setBorderBottom(CellStyle.BORDER_HAIR);
		style.setBorderLeft(CellStyle.BORDER_HAIR);
		style.setBorderTop(CellStyle.BORDER_HAIR);
		style.setFont(font1);
		style.setWrapText(true);
		style.setDataFormat(df.getFormat("#,###,###,##0"));
		styles.put("detail1", style);

		style = wb.createCellStyle();
		style.setAlignment(CellStyle.ALIGN_LEFT);
		style.setVerticalAlignment(CellStyle.VERTICAL_JUSTIFY);
		style.setFillForegroundColor(IndexedColors.WHITE.getIndex());
		style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
		style.setBorderRight(CellStyle.BORDER_HAIR);
		style.setBorderBottom(CellStyle.BORDER_HAIR);
		style.setBorderLeft(CellStyle.BORDER_HAIR);
		style.setBorderTop(CellStyle.BORDER_HAIR);
		style.setFont(font2);
		style.setWrapText(true);
		styles.put("detail2", style);

		style = wb.createCellStyle();
		style.setAlignment(CellStyle.ALIGN_RIGHT);
		style.setVerticalAlignment(CellStyle.VERTICAL_JUSTIFY);
		style.setFillForegroundColor(IndexedColors.WHITE.getIndex());
		style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
		style.setBorderRight(CellStyle.BORDER_HAIR);
		style.setBorderBottom(CellStyle.BORDER_HAIR);
		style.setBorderLeft(CellStyle.BORDER_HAIR);
		style.setBorderTop(CellStyle.BORDER_HAIR);
		style.setFont(font2);
		style.setWrapText(true);
		style.setDataFormat(df.getFormat("#,###,###,##0"));
		styles.put("detail3", style);

		return styles;
	}
}
